import javax.swing.*;
import javax.swing.border.EmptyBorder;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

public class VueSaisiePeriodique extends Vue {

	
	private static final long serialVersionUID = 1L;
	private JPanel contentPane;
	private JButton btnEnregistrer;
	private JButton btnAnnuler;
	private JTextField textField_issn;
	private JTextField textField_nom;
	
	public VueSaisiePeriodique(Controleur controleur) {
		super(controleur);
		setTitle("Enregistrement d'un nouveau périodique");
		setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); 
		setBounds(100, 100, 355, 177);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(null);
		
		JLabel lblNewLabel = new JLabel("ISSN:");
		lblNewLabel.setBounds(97, 38, 61, 15);
		contentPane.add(lblNewLabel);
		
		JLabel lblNewLabel_1 = new JLabel("Nom:");
		lblNewLabel_1.setBounds(97, 65, 61, 15);
		contentPane.add(lblNewLabel_1);
		
		textField_issn = new JTextField();
		textField_issn.setBounds(155, 36, 114, 19);
		contentPane.add(textField_issn);
		textField_issn.setColumns(10);
		
		textField_nom = new JTextField();
		textField_nom.setBounds(155, 63, 114, 19);
		contentPane.add(textField_nom);
		textField_nom.setColumns(10);
		
		btnEnregistrer = new JButton("Enregistrer");
		btnEnregistrer.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				String issn = textField_issn.getText();
				String nom = textField_nom.getText();
				getControleur().nouvPeriodique(issn, nom);
				}
		});
		btnEnregistrer.setBounds(63, 109, 107, 25);
		contentPane.add(btnEnregistrer);
		
		btnAnnuler = new JButton("Annuler");
		btnAnnuler.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
			getControleur().fermerVue(VueSaisiePeriodique.this);}
		});
		btnAnnuler.setBounds(182, 109, 107, 25);
		contentPane.add(btnAnnuler);
	}
}
